{% extends "apps/app_base.html" %}
{% load i18n %}
{% load static %}
{% load base_tags %}

{% block body_class %}{% trans "apps explore" %}{% endblock %}

{% block body %}
  <div class="page-header">
    {% if user.is_authenticated and "add_resource" in user.perms%}
    <div class="dropdown" style="float: right;">
      <button class="btn btn-primary dropdown-toggle" type="button" id="create-new-app-dropdown-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
        {% trans "Create New" %} {% blocktrans %}{{GEONODE_APPS_NAME}}{% endblocktrans %}
        <span class="caret"></span>
      </button>
      <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="create-new-app-dropdown-menu">
       {% for app in GEOAPPS %}
        <li>
          <a href="{% url "new_geoapp" %}?appType={{item}}">
            {% blocktrans %}{{item}}{% endblocktrans %}
          </a>
        </li>
        {% endfor %}
      </ul>
    </div>
    {% endif %}
    <h2>{% trans "Explore" %} {% blocktrans %}{{GEONODE_APPS_NAME}}{% endblocktrans %}</h2>
  </div>
  {% with include_type_filter='true' %}
    {% with header='Type' %}
      {% with filter='app_type__in' %}
        {% include "search/_search_content.html" %}
      {% endwith %}
    {% endwith %}
  {% endwith %}
{% endblock %}

{% block extra_script %}
{{ block.super }}
  <script type="text/javascript">
      {% if HAYSTACK_SEARCH %}
          SEARCH_URL = '{% url 'api_get_search' api_name='api' resource_name='base' %}?type__in=geoapp'
      {% else %}
          SEARCH_URL = '{% url 'api_dispatch_list' api_name='api' resource_name='geoapps' %}';
      {% endif %}
      FILTER_TYPE = 'geoapp';
  </script>
  {% with include_spatial='true' %}
    {% include 'search/search_scripts.html' %}
  {% endwith %}
{% endblock extra_script %}
